package c1.controller;

import c1.entity.user;
import org.springframework.web.bind.annotation.*;

@RestController
public class helloController {

    @RequestMapping("/service/hello")
    public String hello(){
        return "hello,world from provider1";
    }

    @RequestMapping("/service/user")
    public user user(){
        user user1=new user();
        user1.setAge(18);
        user1.setName("张三");
        user1.setPhone("123456");

        return user1;
    };

    @RequestMapping("/service/userCanShu")
    public user userCanShu(@RequestParam("age") Integer age,
                           @RequestParam("name") String name,
                           @RequestParam("phone") String phone){
        user user1=new user();
        user1.setAge(age);
        user1.setName(name);
        user1.setPhone(phone);

        return user1;
    };

    @PostMapping("/post/user1")
    public user paramPost(@RequestParam("age") Integer age,
                           @RequestParam("name") String name,
                           @RequestParam("phone") String phone){
        user user1=new user();
        user1.setAge(age);
        user1.setName(name);
        user1.setPhone(phone);

        return user1;
    };


//    @RequestMapping(value = "/post/user",method = RequestMethod.POST)
    @PostMapping("/post/user2")
    public user postUser(@RequestBody user user2){

        return user2;
    };





}
